﻿package com.danielsheldon.effects.particles 
{
	import flash.display.DisplayObject;
	import flash.display.Sprite;
	
	/**
	 * ...
	 * @author Daniel Sheldon
	 */
	public class Dot extends Sprite implements IParticle
	{
		private var _cos:Number;
		private var _sin:Number;
		private var _lifeSpan:int = 5000;
		private var _lifeLived:int = 0;
		
		public function Dot() 
		{
			graphics.beginFill(Math.random()*0xffffff, 1);
			graphics.drawCircle( -0.5, -0.5, 1);
			graphics.endFill();
		}
		
		public function get cos():Number { return _cos; }
		public function set cos(value:Number):void 
		{
			_cos = value;
		}
		
		public function get sin():Number { return _sin; }
		public function set sin(value:Number):void 
		{
			_sin = value;
		}
		
		public function get lifeSpan():int { return _lifeSpan; }
		public function set lifeSpan(value:int):void 
		{
			_lifeSpan = value;
		}
		
		public function get lifeLived():int { return _lifeLived; }
		public function set lifeLived(value:int):void 
		{
			_lifeLived = value;
			if (_lifeLived >= lifeSpan)
			{
				die();
			}
		}
		
		private function die():void
		{
			Emitter(parent).particleDead(this);
		}
		
	}
	
}